package com.bree.erp.entity;

import java.io.Serializable;

public class BalanceId implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private String warehouse;
	private Long partUnit;
	
	public BalanceId() {
		
	}
	
	public BalanceId(String warehouse, Long partUnit) {
		super();
		this.warehouse = warehouse;
		this.partUnit = partUnit;
	}
	
	@Override
	public boolean equals(Object object) {
		
		if(object instanceof BalanceId) {
			BalanceId that = (BalanceId) object;
			
			return this.warehouse != null && this.partUnit != null
					&& this.warehouse.equals(that.warehouse) 
					&& this.partUnit.equals(that.partUnit);
		}
		
		
		return false;
	}
	
	@Override
	public int hashCode() {
		return (this.warehouse == null ? 0 : this.warehouse.hashCode())
				+ (this.partUnit == null ? 0 : this.partUnit.hashCode());
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder(warehouse).append(":").append(partUnit);
		return sb.toString();
	}

	/**
	 * @return the warehouse
	 */
	public String getWarehouse() {
		return warehouse;
	}

	/**
	 * @return the partUnit
	 */
	public Long getPartUnit() {
		return partUnit;
	}
	
}
